Service Specific Prompts
This document explains the domain-specific prompt systems powering integrated services for GitHub repository analysis, website content understanding, and YouTube video processing. It covers prompt templates, parameter handling, response formatting, service integration, error handling, and optimization strategies. It also describes how prompts are chained across services and how context is preserved for robust, scalable agent workflows.
The repository organizes prompts, services, and FastAPI routers per domain. Prompts define the instruction templates and chains; services orchestrate ingestion, context assembly, and LLM invocation; routers expose HTTP endpoints for each service.
Diagram sources
Section sources
GitHub prompt system: Builds a chain that merges repository summary, file tree, and content with a user question and optional chat history. It enforces strict reliance on provided context and uses Markdown formatting.
Website prompt system: Merges server-fetched and client-rendered contexts, prioritizing client-side content for dynamic and authenticated views. Provides guidelines for summaries, structure, links/media, metadata, and formatting.
YouTube prompt system: Assembles a transcript-based context (with error handling) and applies a focused schema for summaries, duration, stats, themes, sentiment, and recommendations.
React agent prompt: Supplies a tool-use instruction template for agents that rely on tool availability and structured reasoning.
Browser automation prompt: Defines a precise JSON action plan for Chrome extension automation, including DOM manipulation and tab/window control actions, with strong constraints and examples.
Section sources
The system follows a consistent pattern:
Routers validate and parse requests, then delegate to services.
Services ingest domain-specific data (repository, website content, YouTube transcripts), assemble context, and invoke prompt chains.
Prompts define the instruction template and optional context assembly via Runnable chains.
Responses are normalized and returned through routers.
Diagram sources
GitHub Integration Prompts#
Prompt template: System role, repository summary, file tree, relevant content, optional chat history, explicit guidelines, and formatting rules.
Input variables: tree, summary, content, question, chat_history.
Chain composition: RunnableParallel extracts inputs; PromptTemplate formats; LLM client executes; StrOutputParser returns text.
Parameter handling: Router validates presence of url and question; service passes chat_history as a string; optional attached file triggers direct GenAI SDK usage.
Response formatting: Markdown with code blocks and bullet lists; strict adherence to provided context.
Error handling: Dedicated error messages for invalid URLs, accessibility, token limit exceeded, and general failures.
Optimization: Truncates repository content when using GenAI SDK to fit payload limits; preserves concise summaries and trees.
Return User-Friendly Message"]
Diagram sources
Section sources
Website Analysis Prompts#
Prompt template: Dual-context guidance (server-fetched vs client-rendered), explicit preference for client context, and detailed guidelines for summaries, structure, links/media, metadata, tables, and math formatting.
Input variables: server_context, client_context, question, chat_history.
Chain composition: RunnableParallel builds inputs; PromptTemplate + LLM client; StrOutputParser.
Parameter handling: Router validates url and question; service converts client HTML to markdown; chat_history assembled as a string; optional attached file bypasses chain and uses GenAI SDK.
Response formatting: Plain markdown with bullet points, tables, and LaTeX for math.
Error handling: Generalized error message on processing failure; client context fallback when unavailable.
Diagram sources
Section sources
YouTube Processing Prompts#
Prompt template: Focused assistant role for YouTube video questions, guidelines for summary, duration, stats, themes, sentiment, and recommendations, and strict scope limitations.
Input variables: context (transcript), question, chat_history.
Chain composition: RunnableParallel with a get_context function that fetches and cleans subtitles/transcripts; PromptTemplate + LLM client; StrOutputParser.
Parameter handling: Router validates url and question; service optionally uploads attached file via GenAI SDK; chat_history passed as string.
Response formatting: Plain markdown with bullet points, tables, and LaTeX.
Error handling: Known error detection for transcript retrieval; returns empty context when errors occur; service wraps exceptions and returns user-friendly messages.
Diagram sources
Section sources
React Agent Prompt#
Template: Instructional prompt for agents that use tools, framing the question, listing available tools, and instructing to use tools to gather information.
Purpose: Complements the broader React agent orchestration (outside the scope of this document) by providing a consistent tool-use instruction.
Section sources
Browser Automation Prompt#
Template: Comprehensive instruction for generating JSON action plans for Chrome extension automation. Includes DOM manipulation and tab/window control actions, selector guidance, search URL construction, and strict output rules.
Chain composition: ChatPromptTemplate piped to LLM; response parsed via StrOutputParser.
Parameter handling: Router constructs a user prompt from goal, target URL, DOM structure, and constraints; service sanitizes and validates JSON action plan.
Diagram sources
Section sources
Routers depend on models and services to handle requests and responses.
Services depend on prompts for chain composition and on domain tools for context ingestion.
Prompts depend on the LLM client abstraction and LangChain components for formatting and parsing.
Diagram sources
Section sources
Context size management:
GitHub service truncates repository content when using GenAI SDK to avoid payload limits.
Website service assembles concise server and client contexts; client context is preferred but fallback is supported.
YouTube service cleans transcripts and falls back to empty context on known errors.
Token limits and retries:
GitHub service detects token limit exceeded and suggests narrowing the scope.
Browser automation limits DOM preview entries to reduce token usage.
Streaming and latency:
Chains are synchronous in current implementation; consider streaming responses at routers/services for long-running prompts.
Model selection:
Services support passing llm_options to prompt builders for model tuning.
[No sources needed since this section provides general guidance]
GitHub
Invalid repository URL: Returns guidance to use the repository root.
Access issues (404/clone): Requests public repository verification.
Token limit exceeded: Advises focusing on specific files/directories.
Website
General processing error: Returns a friendly message to retry.
Client HTML missing: Falls back to server context; client context is optional.
YouTube
Transcript retrieval errors: Known error messages detected and handled gracefully; returns empty context.
LLM invocation errors: Wrapped with a user-friendly message.
Browser automation
JSON validation failures: Validation returns problems; endpoint returns structured error response.
React agent
Attached file upload failures: Logs and returns a user-friendly message; otherwise normal operation.
Section sources
The prompt systems are modular, domain-focused, and integrated with robust services and routers. They emphasize context grounding, strict formatting, and resilient error handling. By preserving and combining context across services—especially client-side rendering for websites and transcripts for YouTube—the system supports advanced, cross-domain reasoning and automation.